import http from "@/api";
import { AddPostionParam, EditPositionParam, GetPositionParam, PositionDetailListType, PositionDetailParam, PositionListType, PostionMemberParam, UserListType } from "@Tea/model";

const positionManageHttp = {
  // 获取职位列表
  getPositioList: (params:GetPositionParam) => http<PositionListType[]>({
    method: "post",
    url: "/admin/personnelManage/memberManage/positionManage/positonList",
    params
  }),
  // 获取职位详情
  positionDetail: (params:PositionDetailParam) => http<PositionDetailListType[]>({
    method: "post",
    url: "/admin/personnelManage/memberManage/positionManage/positonDetail",
    params  
  }),
  // 新增职位
  addPosition:(params:AddPostionParam) => http<null>({
    method: "post",
    url: "/admin/personnelManage/memberManage/positionManage/addPosition",
    params
  }),
  // 编辑职位
  editPosition:(params:EditPositionParam) => http<null>({
    method: "post",
    url: "/admin/personnelManage/memberManage/positionManage/editPosition",
    params
  }),
  // 删除职位
  delPosition: (positionCode: AddPostionParam["positionCode"]) => http<null>({
    method: "delete",
    url: "/admin/personnelManage/memberManage/positionManage/delPosition",
    params: { positionCode }
  }),
  // 添加成员
  addPositionMember: (params: PostionMemberParam) => http<null>({
    method: "post",
    url: "/admin/personnelManage/memberManage/positionManage/addMember",
    params
  }),
  // 添加成员
  delPositionMember: (id: number) => http<null>({
    method: "delete",
    url: "/admin/personnelManage/memberManage/positionManage/delMember",
    params: { id }
  }),
  addableList: () => http<UserListType[]>({
    method: "get",
    url: "/admin/personnelManage/memberManage/positionManage/addableList",
  })
}

export default positionManageHttp